import http from "@/utils/http";

/**
 * @description: 加入-购物车
 * @data {*} skuId string  商品sku的id  count integer 商品数量
 * @return {*}
 */
export const addCartAPI = ({skuId, count}) => {
  return http({
    url: "/member/cart",
    method: "post",
    data: {
      skuId,
      count
    },
  })
}
/**
 * @description: 获取-购物车列表
 * @param {*} 
 * @return {*}
 */
export const getCartAPI = () => {
  return http({
    url: "/member/cart",
    method: "get",
  })
}
/**
 * @description: 删除-购物车
 * @param {*} ids string  商品sku的id  count integer 商品数量
 * @return {*}
 * */
export const deleteCartAPI = (ids) => {
  return http({
    url: "/member/cart",
    method: "delete",
    data: {ids},
  })
}
/**
 * @description: 合并购物车
 * @data {*} array of: 数组
 * skuId string  商品sku的id
 * selected string 商品选中状态
 * count integer 商品数量
 * @return {*}
 * 
 * */
export const mergeCartAPI = (cartInfo) => {
  return http({
    url: "/member/cart/merge",
    method: "post",
    data: cartInfo,
  })
}